<?php /*
	
*/ ?>
<?php include("inc/head.inc.php") ?>
<?php
if(!isset($_SESSION['memberid'])) {
	header("location:customerlogin.php?cond=1");
}
?>
<body>
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php") ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php") ?></td>
        <td valign="top">
		<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr>
          <td width="88%" height="23" bgcolor="#000000" class="style1">&nbsp; Order Detail </td>
          <td width="12%" align="center" bgcolor="#000000" class="head"><a href="#" class="navigation" onClick="history.go(-1);">BACK</a></td>
        </tr>
		
        <tr>
          <td colspan="2" align="left" class="prborderbg">
		  
		  <table width="100%" border="0" cellpadding="0" cellspacing="2" class="proborder">
<?php 
if(isset($_REQUEST['orderid']) && ($_REQUEST['orderid'])!="") {
		$oid=mysql_real_escape_string($_REQUEST['orderid']);
		$sql="select * from tblorders where intid='$oid'";
		$result=$n02586916_db->select($sql);
		if($result) {
		  ?>
            <tr>
              <td height="20" colspan="3" class="fntstyle">&nbsp;&nbsp;<strong>Order Tracking</strong></td>
              </tr>
            <tr>
              <td width="25%" class="fntstyle"><strong>&nbsp;&nbsp;Order No:</strong></td>
              <td width="73%" class="fntstyle"><?php echo $result[0]['intid'];?></td>
            </tr>
            <tr>
              <td class="fntstyle"><strong>&nbsp;&nbsp;Order Date:</strong></td>

              <td class="fntstyle"><?php echo printdate($result[0]['dtfinished']);?></td>
            </tr>
            <tr>
              <td colspan="3" valign="top">&nbsp;</td>
              </tr>
            <tr>
              <td height="20" colspan="2" valign="middle" class="fntstyle"><strong> &nbsp;&nbsp;Delivery Address </strong></td>
              </tr>
            <tr>
              <td>&nbsp;</td>
              <td><span class="font"><?php echo
			   stripslashes($result[0]['vardeliverystreetaddress'])."<br />".
			   stripslashes($result[0]['vardeliverycity'])."<br />".
			   stripslashes($result[0]['vardeliverypostcode'])."<br />".
			   stripslashes($result[0]['vardeliverystate'])."<br />".
			   stripslashes($result[0]['vardeliverycountry']); ?></span></td>
            </tr>
            
            <tr>
              <td height="20" colspan="2" class="fntstyle"><strong>&nbsp;&nbsp;Billing Address</strong></td>
              </tr>
            <tr>
              <td>&nbsp;</td>
              <td><span class="font"><?php echo 
			   stripslashes($result[0]['varbillingstreetaddress'])."<br />".
			   stripslashes($result[0]['varbillingcity'])."<br />".
			   stripslashes($result[0]['varbillingpostcode'])."<br />".
			   stripslashes($result[0]['varbillingstate'])."<br />".
			   stripslashes($result[0]['varbillingcountry']); ?></span></td>
            </tr>
            <tr>
              <td height="20" colspan="2" class="fntstyle"><strong>&nbsp;&nbsp;Products</strong></td>
              </tr>
            <tr>
              <td class="font">&nbsp;</td>
              <td class="font"><?php 
				$sql1="select * from tblorderproducts where intorderid=$oid";
				$res1=$n02586916_db->select($sql1);
				if($res1) {
					for ($b=0;$b<count($res1);$b++) {
						$sql9="select * from tblproddesc where intid=".$res1[$b]['intproductid'];
						$resimg=$n02586916_db->select($sql9);
						echo stripslashes($resimg[0]['varprodname'])." (Code: ".stripslashes($res1[$b]['intproductid']).") Quantity: ".$res1[$b]['intquantity']."<br />";
					}
		  		 }
				 ?>
			</td>
            </tr>
			<tr>
              <td class="fntstyle" style="padding-left:7px;"><strong>Order total value:</strong></td>
              <td class="font"><strong>&pound;<?php echo $result[0]['totalvalue'];?></strong></td> 
            </tr>
			<tr>
              <td class="fntstyle" style="padding-left:7px;"><strong>Shipping Method:</strong></td>
              <td class="font">
			  <?php
			  	$sql1="select * from tblshippingmaster where intid=".$result[0]['shipmethod'];
				$res1=$n02586916_db->select($sql1);
				if($res1) {
					echo stripslashes($res1[0]['vartitle'])." - ".stripslashes($res1[0]['vardesc']);
				}
			  ?>
			  </td> 
            </tr>
            <tr>
              <td class="fntstyle" style="padding-left:7px;" valign="top"><strong>Order Status</strong></td>
              <td align="left" class="font"><?php
			  $staid=$result[0]['intcurrentorderstatus'];
			  $sql2 = "SELECT *	FROM `tblorderstatus` WHERE intid=$staid"; 
			  $res2 = $n02586916_db->select($sql2);
			  echo "<strong>".stripslashes($res2[0][1])."</strong>";
			  echo "<br /><br />";
			  
			  
			  $sql2 = "select *	from `tblorderstatushistory` where  intcustomernotify!=3 and intorderid=$oid"; 
			  $res2 = $n02586916_db->select($sql2);
				if(count($res2)>0)	{	 
					for($r=0;$r<count($res2);$r++) {
						$statusid= $res2[$r]['intorderstatusid'];	
						$statussql = "SELECT *	FROM `tblorderstatus` WHERE intid=$statusid"; 
						$statusresult = $n02586916_db->select($statussql);
						$note=stripslashes($res2[$r]['varcomments']);	
						$date=$res2[$r]['dtdateadded'];	
						echo "<img src='images/arrow.jpg' width='13' height='13' /> $date --> ".stripslashes($statusresult[0][1])." ($note)<br />";
					}
				}
	}
}
			  ?></td>
              </tr>
            <tr>
              <td colspan="3" align="center" class="fontsmall"></td>
            </tr>
          </table>
      
       </td>
        </tr> 
    </table>		</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</body>
</html>
